package com.relation.action;

import com.relation.db.Dao;
import com.relation.domain.Resource;
import com.relation.utils.PagingOption;
import com.relation.utils.PagingResult;

public class ResourcesAction extends ActionBase{
	
	private int type;
	private PagingOption option;
	private PagingResult<Resource> pagingItems;
	
	public String execute()
	{
		if (option == null)
		{
			option = new PagingOption();
			option.setLimit(50);
		}
		System.out.print("type: " + type);
		pagingItems = Dao.INSTANCE.getResource(type, option.getOffset(), option.getLimit());
		pagingItems.setOption(option);
		return SUCCESS;
	}

	public void setType(int type) {
		this.type = type;
	}

	public int getType() {
		return type;
	}

	public void setOption(PagingOption option) {
		this.option = option;
	}

	public PagingOption getOption() {
		return option;
	}

	public void setPagingItems(PagingResult<Resource> pagingItems) {
		this.pagingItems = pagingItems;
	}

	public PagingResult<Resource> getPagingItems() {
		return pagingItems;
	}
	
}
